<style>
    input,textarea{width: 220px !important;}
</style>
<div class="yx-clear">
    <label class="zx-label">会员名称</label>
    <div class="zx-field-floatl" style="padding:5px 0;">
        <?=\yii\helpers\Html::encode($customer->name)?>
    </div>
</div>
<div class="yx-clear">
    <label class="zx-label">账户余额</label>
    <div class="zx-field-floatl" style="padding:5px 0;">
        <?= \yii\helpers\Html::encode(isset($BAccout)?$BAccout->cash:0); ?>
    </div>
</div>
<?= $form ?>

<div class="yx-clear">
    <label class="zx-label">实付</label>
    <div class="zx-field-floatl" style="padding:5px 0;">
        <span id="customer-paid-count">0</span>
    </div>
</div>
<div class="yx-clear">
    <label class="zx-label">合计</label>
    <div class="zx-field-floatl" style="padding:5px 0;">
        <span id="customer-charge-count">0</span>
    </div>
</div>
<script>
   $(document).on('focusout','input',function () {
            rg = /^(([1-9][\d]*)(\.[\d]{1,3})?)|(0\.[\d]{1,3})$/;
            var num = 0;
            var paid = 0;
            var type = $(this).data('type');
            $('input').each(function () {
                if (rg.test($(this).val())) {
                    ha = $(this).val();
                    num = parseFloat(ha)+num;
                    if(type != 'free')
                        paid = parseFloat(ha)+ paid;
                }
            });
            $('#customer-charge-count').html('¥'+num);
           if(type != 'free')
            $('#customer-paid-count').html('¥'+paid);
        });
</script>


